/**
 * OWASP GoatDroid Project
 * 
 * This file is part of the Open Web Application Security Project (OWASP)
 * GoatDroid project. For details, please see
 * https://www.owasp.org/index.php/Projects/OWASP_GoatDroid_Project
 *
 * Copyright (c) 2011 - The OWASP Foundation
 * 
 * GoatDroid is published by OWASP under the GPLv3 license. You should read and accept the
 * LICENSE before you use, modify, and/or redistribute this software.
 * 
 * @author Jack Mannino, nVisium Security (https://www.nvisiumsecurity.com)
 * @created 2011
 */
package org.owasp.goatdroid.fourgoats.webservice.resources;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.CookieParam;
import javax.ws.rs.QueryParam;
import org.owasp.goatdroid.fourgoats.webservice.Constants;
import org.owasp.goatdroid.fourgoats.webservice.history.HistoryImpl;
import org.owasp.goatdroid.fourgoats.webservice.history.beans.HistoryBean;
import org.owasp.goatdroid.fourgoats.webservice.history.beans.HistoryCheckinBean;

@Path("/fourgoats/api/v1/history")
public class History {

	@Path("list")
	@GET
	@Produces("application/json")
	public HistoryBean getHistory(
			@CookieParam(Constants.SESSION_TOKEN_NAME) String sessionToken) {

		return HistoryImpl.getHistory(sessionToken);
	}

	@Path("get_checkin")
	@GET
	@Produces("application/json")
	public HistoryCheckinBean getCheckin(
			@CookieParam(Constants.SESSION_TOKEN_NAME) String sessionToken,
			@QueryParam("checkinID") String checkinID) {

		return HistoryImpl.getCheckin(sessionToken, checkinID);

	}

	@Path("get_user_history")
	@GET
	@Produces("application/json")
	public HistoryBean getHistory(
			@CookieParam(Constants.SESSION_TOKEN_NAME) String sessionToken,
			@QueryParam("userName") String userName) {

		return HistoryImpl.getUserHistory(sessionToken, userName);
	}
}
